package com.acane.instagram.feature.collection


import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.composable
import com.acane.instagram.feature.common.SessionManager


const val COLLECT_LIST = "collect_list"

const val COLLECTION_POST_POSITION = "post_position"


fun NavGraphBuilder.collectionListScreen(
    navController: NavHostController,
    toProfile: (String) -> Unit,
) {

    composable(
        "$COLLECT_LIST/{$COLLECTION_POST_POSITION}"
    ) {

        backStackentry ->
        val userId = SessionManager.currentUser?.id
        val postPosition = backStackentry.arguments!!.getInt(COLLECTION_POST_POSITION)

        CollectionPostList(
            toProfile = toProfile,
            navController = navController,
            userId = userId,
            postPosition = postPosition,
        )
    }
}
fun NavController.navigateToCollectionList(postPosition: Int): Unit {
    navigate("${COLLECT_LIST}/$postPosition")
}